OPC Studio User's Guide and Reference
OPC Common Dialogs
Client and Subscriber Development > Features > User Interface > OPC Common Dialogs
In This Topic

Windows Forms

QuickOPC contains a set of Windows Forms dialog boxes for performing common OPC-related tasks such as selecting an OPC server or OPC item in OPC “Classic”, or selecting an OPC server endpoint, or an OPC data node within the server, in OPC Unified Archiecture.

The dialog objects are all derived from System.Windows.Forms.CommonDialog, providing consistent and well-known programming interface to use.

You can drag any of the dialog components from the Visual Studio toolbox to the designer surface, and then configure its properties. It is also possible to use the dialog components without the designer support – simply instantiate the dialog class, and work with its properties and methods from your code.

The properties of each dialog that have significance for its functionality are categorized as follows:

Category Description
Mode Determines the overall behavior of the dialog. For example, some dialogs allow you to choose whether a single selection or multi-selection will be performed.
Inputs Information necessary for running the dialog that the user cannot change. For example, with an OPC-DA Item Dialog, the dialog inputs consists of the machine name and the OPC server to be browsed.
Inputs/Outputs Information that can be provided as initial data, but the dialog user can change it. For example, with an OPC-DA Item Dialog, the information about the selected item can passed into the dialog so that it is pre-selected at the beginning. Corresponding information may also exist in the Outputs category; the difference is that the Outputs contain more details (typically in the form of some of the XXXXElement classes), while the Inputs/Outputs only contains the necessary identifying data (could be in form of XXXXDescriptor classes).
Outputs The selection(s) that the user has made in the dialog.

All OPC browsing dialogs have an additional SizeFactor property. The property allows the developer to influence the (initial) size of the dialog on screen. It can be set to one of the pre-defined values (SizeFactors.Small/Normal/Large/ExtraLarge), or to any SizeF structure, defining a width and height relative to the normal size. An additional SizeFactorName is provided primarily to allow easy access to this feature to COM callers.

All OPC browsing dialogs also have an additional RetainAppearance property. When set (which is the default behavior), the dialog retains its appearance (mainly, the location and size), between invocations. It is also possible to call the RevertAppearance() method on the dialog, to restore the original values.

When any of the common dialog components is placed onto the designer surface and its properties configured, it can be tested without a need to build the project. To perform the test, use the “Test Dialog” command, available from the context menu on the dialog component itself, or the same command in the Properties window, when the dialog component is selected (you may have to right-click in the property grid and check "Commands" first, to display the commands under the property grid).

WPF

Although the OPC common dialogs use the Windows Forms techbology, they can be easily used from WPF applications as well. Instances of dialog boxes can be created, and their properties set in the code, and when you want to display the dialog and have the user interact with it, call the dialog-s CommonDialog.ShowDialog Method.

An example of this approach can be seen in the (C#) examples solution, in the WPF/WpfEasyOpcUADemo project. The "Browse servers" and "Browse data" buttons on the main WPF form invoke the (WinForms-based) OPC browsing dialogs.

Notes

The features discussed here, or some of them, may not be available in all editions of the product. Check the Product Editions page for differences between the editions. The trial license has all features enabled (and is limited in period for which it provides valid data), but licenses for specific commercial editions may have functionality limitations.

In runtime, all user interface features (such as controls, dialogs, and live binding; Windows Forms and WPF) and nonvisual components are supported both under .NET Framework and .NET 6+. However, "designing" them (this includes tasks like dragging from the Toolbox, or configuring in Properties window) in Visual Studio is only possible in .NET Framework projects. In order to achieve visual design for .NET 6+ projects, the developer can make two project files over the same set of source files, one targeting .NET Framework and one targeting .NET 6+, and use the project that targets .NET Framework for visual design tasks.

 

See Also